home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr50
/
bcc101.zip
/
DIALOG.ZIP
/
TESTDLOG.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-01-13
|
7KB
|
155 lines
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' testdlog.bas '
' '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' compile -> bc testdlog /o; '
' compile -> bc dialog /o; '
' link -> link /e testdlog + dialog, , nul, qb; '
' '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'$INCLUDE: 'DIALOG.BI'
DIM Menu$(1 TO 5), Prompt$(1 TO 5)
Menu$(1) = " Lotus 123 spreadsheet reports "
Menu$(2) = " dBase company product reports "
Menu$(3) = " Telix - com to main facility "
Menu$(4) = " SERVICES system management "
Menu$(5) = " Exit this phoney menu system "
Prompt$(1) = " Make, create or modify company profit/loss reports. "
Prompt$(2) = " Track salesmen and accounts to various product lines."
Prompt$(3) = " Telephone hookup to company's main computer in Tulsa."
Prompt$(4) = " Promo for ORCA Pacific's Professional SERVICES 4.0 "
Prompt$(5) = " Quit, finished, done, ie., we're out of this program."
Msg1$ = ""
Msg1$ = Msg1$ + " ░▒▓ BoxDialog Demonstration ▓▒░"
Msg1$ = Msg1$ + " "
Msg1$ = Msg1$ + "Simply define the message to dis-play (like this one), "
Msg1$ = Msg1$ + "the row to start the display, the corner and side "
Msg1$ = Msg1$ + "characters of the dis-play box, the color attribute for "
Msg1$ = Msg1$ + "the display and the width of the boxed display. The "
Msg1$ = Msg1$ + "routine will automatically word wrap your text and "
Msg1$ = Msg1$ + "center the box, re-gardless of the number of col-umns "
Msg1$ = Msg1$ + "your display is currently set for."
Strike$ = " Strike any key to continue... "
StrikeCorners$ = "█▀████▄█"
VidInfo ' obtain video information
Background$ = STRING$(MonRows * MonCols, 176) ' setup fancy background
WriteStr Background$, 1, 1, ClrAttr(12, 1) ' do a fancy background
BoxDialog 1, 37, "╔═╗║║╙─╜", Msg1$, ClrAttr(15, 5), 1
BoxDialog 19, LEN(Strike$) + 4, StrikeCorners$, Strike$, ClrAttr(1, 3), 1
GOSUB Wait4Key
WIDTH 40 ' change to 40 column screen
VidInfo ' obtain video information
WriteStr LEFT$(Background$, 1000), 1, 1, ClrAttr(12, 1) ' fancy background
Msg1$ = Msg1$ + " BTW, this call to BoxDialog is exactly the "
Msg1$ = Msg1$ + "same as before."
' exact same call as before
BoxDialog 1, 37, "╔═╗║║╙─╜", Msg1$, ClrAttr(14, 4), 1
BoxDialog 21, LEN(Strike$) + 4, StrikeCorners$, Strike$, ClrAttr(14, 2), 1
GOSUB Wait4Key
WIDTH 80 ' change to 80 column screen
VidInfo ' obtain video information
WriteStr Background$, 1, 1, ClrAttr(12, 1) ' do a fancy background
BoxDialog 1, 37, "╔═╗║║╙─╜", Msg1$, ClrAttr(1, 3), 1 ' still the same call
BoxDialog 21, LEN(Strike$) + 4, StrikeCorners$, Strike$, ClrAttr(15, 3), 1
GOSUB Wait4Key
Msg$ = "Use this routine for all kinds of things like helpful prompts "
Msg$ = Msg$ + "correlated to your highlighted menu options."
Msg$ = Msg$ + SPACE$(53)
Msg$ = Msg$ + "Two more notes: This routine word wraps at spaces, "
Msg$ = Msg$ + "dashes, dots, commas, colons and semi-colons. Also, "
Msg$ = Msg$ + "leading spaces are NOT trimmed!"
BoxDialog 3, 58, "╒═╕║║╘═╛", Msg$, ClrAttr(15, 4), 1
BoxDialog 13, LEN(Strike$) + 4, "▐▀▌▐▌▐▄▌", Strike$, 14, 1
GOSUB Wait4Key
WriteStr Background$, 1, 1, ClrAttr(12, 1) ' do a fancy background
'---- Now show how to use this for menu systems. ----
promptW = LEN(Prompt$(1)) + 4 ' calculate width of box
leftpos = 1 + ((MonCols - promptW) \ 2) ' compute left column
IF leftpos > 1 THEN leftpos = leftpos + (promptW MOD 2)
leftpos = leftpos + 2 ' move it beyound left side of box
BoxWidth = LEN(Menu$(1)) + 4 ' calculate width of box
Temp$ = " QBNews Phoney Menu System " ' add menu title
Temp$ = Temp$ + SPACE$(LEN(Temp$)) ' add one line of space
Temp$ = Temp$ + Menu$(1) + Menu$(2) + Menu$(3) + Menu$(4) + Menu$(5)
BoxDialog 3, BoxWidth, "╔═╗║║╚═╝", Temp$, 14, 1 ' draw the menu
' draw boxed prompt
BoxDialog 14, promptW, "╒═╕││╘═╛", Prompt$(1), ClrAttr(15, 5), 1
Temp$ = "This phoney menu system is sized and displayed via BoxDialog()."
Temp$ = Temp$ + "Use <Up> and <Down> to select. "
Temp$ = Temp$ + "<Enter> on #5 or <Esc> aborts."
' draw message sans shadow
BoxDialog 19, 67, "┌─┐││└─┘", Temp$, ClrAttr(15, 4), 0
choice = 1 ' start with menu choice #1
leftcol = 1 + ((MonCols - BoxWidth) \ 2) ' compute left column
IF leftcol > 1 THEN leftcol = leftcol + (BoxWidth MOD 2)
leftcol = leftcol + 2 ' move it beyound left side of box
GOSUB HiChoice ' highlight first choice
DO
ans$ = INKEY$ ' get a key from the keyboard buffer
IF ans$ = CHR$(0) + CHR$(72) THEN ' up arrow
GOSUB ClearHi ' clear highlighted item
choice = choice - 1 ' decrement choice
IF choice < 1 THEN choice = 5 ' wrap if at top
GOSUB HiChoice ' highlight new choice
ELSEIF ans$ = CHR$(0) + CHR$(80) THEN ' down arrow
GOSUB ClearHi ' clear highlighted item
choice = choice + 1 ' increment choice
IF choice > 5 THEN choice = 1 ' wrap if at bottom
GOSUB HiChoice ' highlight new choice
ELSEIF ans$ = CHR$(13) THEN ' enter key
IF choice = 5 THEN EXIT DO ELSE BEEP ' if at "exit" choice
ELSEIF ans$ = CHR$(27) THEN ' escape key
EXIT DO
ELSEIF LEN(ans$) THEN ' any other keystroke
BEEP ' beep em up, Scotty
END IF
LOOP
Msg$ = STRING$(MonRows * MonCols, 32) ' string of blanks
WriteStr Msg$, 1, 1, 7 ' clear the screen
END
Wait4Key:
DO: LOOP UNTIL LEN(INKEY$) ' wait for a keystroke
RETURN
HiChoice:
' ---- highlight menu choice
WriteStr Menu$(choice), choice + 5, leftcol, ClrAttr(0, 7)
' ---- display new menu prompt
WriteStr Prompt$(choice), 15, leftpos, ClrAttr(15, 5)
RETURN
ClearHi:
' ---- clear highlight from menu item
WriteStr Menu$(choice), choice + 5, leftcol, 14
RETURN